import 'package:flutter/material.dart';
import 'package:flutter/cupertino.dart';
import './pages/index.dart';
import './pages/login.dart';
// import 'package:shared_preferences/shared_preferences.dart';

void main() => runApp(YddApp());
class YddApp extends StatefulWidget {
    @override
    State<StatefulWidget> createState() => new MyYddClientState();
}

class MyYddClientState extends State<YddApp> {
    final tabTextStyleNormal = new TextStyle(color: const Color(0xff969696));
    final tabTextStyleSelected = new TextStyle(color: const Color(0xff63ca6c));

    @override
    void didChangeDependencies() {
      super.didChangeDependencies();
      new Future.delayed(const Duration(seconds: 3),(){
        print('Duration');
        Navigator.pushReplacementNamed(context, 'login');
      });
    }

    @protected
    @mustCallSuper
    void changedInternalState() {
      print('changedInternalState');
    }

    @protected
    @mustCallSuper
    void install(OverlayEntry insertionPoint) {
      print('install');
     }

    Widget build(BuildContext context) {
        return MaterialApp(
            title: '鱼大大+',
            theme: new ThemeData(primarySwatch: Colors.green),
            home: HomePage(),
            // user: MyButton()
            routes: {
              'user': (context) => NewRoute(),
              'login': (context) => Login()
            },
        );
    }
}

class NewRoute extends StatelessWidget{
  Widget build(BuildContext context) {
    return new Scaffold(
      appBar: new AppBar(
        title: new Text('NAV'),
        centerTitle: true
      ),
      body: Align(
        child: new Text('qeqe'),
      )
    );
  }
}
